package adroid.kryten.util;

import java.util.List;

import android.content.Context;
import android.kryten.R;
import android.kryten.model.Document;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class DocumentsAdapter extends ArrayAdapter<Document> {

	/**
     * @param context
     * @param resource
     * @param textViewResourceId
     * @param objects
     */
    public DocumentsAdapter(Context context, List<Document> documents) {
        super(context, 0, 0, documents);
    }

    
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
    	
        Document doc = getItem(position);
        
        if (convertView == null)
            convertView = View.inflate(getContext(), R.layout.document_item, null);
        
        TextView tvAuthor = (TextView)convertView.findViewById(R.id.document_item_author);
        TextView tvNews = (TextView)convertView.findViewById(R.id.document_item_name);
                
        if (doc != null) {
            tvAuthor.setText(doc.getName());
        	tvNews.setText(doc.getName());
            
        }
        return convertView;
    }
    
	
}
